<?php
$title = 'title'.$rear;
$alias = 'alias'.$rear;
$intro = 'introtext'.$rear;
$full = 'fulltext'.$rear;
?>
<?php if(!empty($news_top)) {
?>
<div class="row-top-news">
    <ul id="scroller">
    <?php foreach ($news_top as $news_top) { ?>
        <li><a title="<?php echo $news_top->$title; ?>" href="<?php the_permalink($news_top->id); ?>"><?php echo $news_top->$title; ?></a></li>
        <?php } ?>
    </ul>
</div>
<?php } ?>
<?php if(!empty($slideshow)) { ?>
<div class="module-body">
    <ul id="slider">
        <?php foreach ($slideshow as $slideshow) { ?>
        <li><a href="<?php echo $slideshow->link ?>" title="<?php echo $slideshow->title; ?>"><img src="<?php echo image($slideshow->image,'thumb_slide'); ?>" alt="<?php echo $slideshow->title; ?>"/></a></li>
        <?php } ?>
    </ul>
</div>
<?php } ?>
<?php if(!empty($giaovien)) { ?>
<!-- Module main body -->
<div class="module-body">
    <div class="title-module">
        <div class="box-news-row">
            <div class="box-in-row"><p>Giáo viên</p></div>
        </div>
    </div>
    <div class="content-module">
        <ul class="clearfix">
            <?php foreach($giaovien as $giaovien) {
                ?>
                <li class="fancybox-li">
                    <div class="teacher-img">
                        <a href="<?php echo base_url().'giao-vien/'.$giaovien->username; ?>"><img src="<?php echo base_url();?>skin/images/duymuoi.png"/></a>
                    </div>
                    <a class="teacher-name" href="<?php echo base_url().'giao-vien/'.$giaovien->username; ?>"><?php echo $giaovien->firstname.' '.$giaovien->lastname; ?></a>
                </li>
                <?php
            } ?> 
        </ul>
        <a class="list-teacher" href="#"></a>
    </div>
</div>
<!-- End module main body -->
<?php  } ?>
<?php if(!empty($comment)) {
    
?>
<!-- Module main body -->
<div class="module-body">
    <div class="title-module">
        <div class="box-news-row">
            <div class="box-in-row"><p>Nhận xét của người học</p></div>
        </div>
    </div>
    <div class="content-module">
        <ul class="clearfix user-comment">
           <?php foreach ($comment as $comment) {
            ?>
             <li>
                <span class="name-user"><?php $comment->comments_fistname.' '.$comment->comments_lastname; ?></span>
                <span class="time-user" style="color: red;">(<?php echo $comment->comment_date; ?>) </span><?php echo character_limiter($comment->comments_text,350); ?><a class="detail-comment" title="<?php echo character_limiter($comment->comments_text,30); ?>" href="<?php echo site_url('comment'.$comment->comments_id); ?>">Xem chi tiết</a>
            </li>
            <?php
           } ?>
        </ul>
    </div>
</div>
<?php } ?>
<?php if(!empty($cat_index)) {
    foreach ($cat_index as $key => $value) {
?>
<!-- Module main body -->
<div class="module-body <?php echo 'cat-'.$key ?>">
    <div class="title-module">
        <div class="box-news-row">
            <div class="box-in-row"><p><?php echo $value['info']->$title; ?></p></div>
        </div>
    </div>
    <div class="content-module">
        <ul class="clearfix service-en" >
            <?php if(!empty($value['data_post'])) {
                $i = 1;
                foreach ($value['data_post'] as $data_post)
                {
                    ?>
                    <li class="clearfix">
                        <a href="<?php the_permalink($data_post->id); ?>" title="<?php echo $data_post->$title; ?>">
                            <img src="<?php echo image($data_post->image,'square'); ?>" alt="<?php echo $data_post->$title; ?>" class="service-img"/>
                        </a>
                        <div class="service-body">
                            <a class="title-service" href="<?php the_permalink($data_post->id); ?>" title="<?php echo $data_post->$title; ?>">
                                <span><?php echo $i; ?></span>
                                <?php echo $data_post->$title; ?></a>
                            <p>
                                <?php echo character_limiter($data_post->$intro,450); ?>
                            </p>
                        </div>
                    </li>
                    <?php
                    $i++;
                }
             } else {  echo 'Danh Mục chưa có bài viết!';} ?>
        </ul>
    </div>
</div>
<?php }} ?>
<!-- End module main body -->